#include "../../Server.hpp"
int main()
{
    //把子进程退出的信号直接忽略，这样父进程就不需要再管它了。
    signal(SIGCHLD,SIG_IGN);
    Socket client;
    for (int i = 0; i < 10; i++){
        pid_t fd = fork();
        if (fd < 0){
            return -1;
        } 
        else if(fd == 0){
            //子进程
            client.CreateClient(8080,"127.0.0.1");
            std::string req = "GET /hello HTTP/1.1\r\nContent-Length: 0\r\nConnection: keep-alive\r\n\r\n";
            while(true){
                assert(client.Send(req.c_str(),req.size()) != -1);    
                char buffer[1024] = {0};
                assert(client.Recv(buffer,1023) != -1);
                DBG_LOG("%s",buffer);
            }
        }
    }
    while(1) sleep(1);
    return 0;
}